import rclpy
from rclpy.node import Node

def main():

    # 节点初始化
    rclpy.init()
    # 定义节点名
    node = Node("Python_node")
    # 节点日志打印
    node.get_logger().info("Hello world!")
    node.get_logger().warn("Hello world!")

    # 运行节点
    rclpy.spin(node)
    # 节点关闭
    rclpy.shutdown()

# if __name__ == "__main__":

#     main()